import http from "../api";

// 获取CPU数据
export const getCPUData = (page: number, limit: number, searchKey?: any) => {
  return http({
    url: "/cpu/cpuinfo",
    method: "get",
    //分页参数
    params: {
      page,
      limit,
      ...searchKey,
    },
  });
};

// 通过id获取CPU数据
export const getCPUDataById = (id: string) => {
  return http({
    url: `/cpu/cpuinfo/${id}`,
    method: "get",
  });
};

// 获取GPU数据
export const getGPUData = (page: number, limit: number, searchKey: any) => {
  return http({
    url: "/gpu/gpuinfo",
    method: "get",
    //分页参数
    params: {
      page,
      limit,
      ...searchKey,
    },
  });
};

// 通过id获取GPU数据
export const getGPUDataById = (id: string) => {
  return http({
    url: `/gpu/gpuinfo/${id}`,
    method: "get",
  });
};

// 获取主板数据
export const getMainboardData = (
  page: number,
  limit: number,
  searchKey: any
) => {
  return http({
    url: "/center/info",
    method: "get",
    //分页参数
    params: {
      page,
      limit,
      ...searchKey,
    },
  });
};

// 通过id获取主板数据
export const getMainboardDataById = (id: string) => {
  return http({
    url: `/center/info/${id}`,
    method: "get",
  });
};

// 获取内存数据
export const getMemoryData = (page: number, limit: number, searchKey) => {
  return http({
    url: "/memory/info",
    method: "get",
    //分页参数
    params: {
      page,
      limit,
      ...searchKey,
    },
  });
};

// 通过id获取内存数据
export const getMemoryDataById = (id: string) => {
  return http({
    url: `/memory/info/${id}`,
    method: "get",
  });
};

//获取ssd数据
export const getSSDData = (page: number, limit: number, searchKey) => {
  return http({
    url: "/ssd/info",
    method: "get",
    //分页参数
    params: {
      page,
      limit,
      ...searchKey,
    },
  });
};

// 通过id获取ssd数据
export const getSSDDataById = (id: string) => {
  return http({
    url: `/ssd/info/${id}`,
    method: "get",
  });
};

//获取hdd数据
export const getHDDData = (page: number, limit: number, searchKey) => {
  return http({
    url: "/hdd/info",
    method: "get",
    //分页参数
    params: {
      page,
      limit,
      ...searchKey,
    },
  });
};

// 通过id获取hdd数据
export const getHDDDataById = (id: string) => {
  return http({
    url: `/hdd/info/${id}`,
    method: "get",
  });
};

//请求所有CPU数据
export const getAllCPUData = () => {
  return http({
    url: "/cpu/total",
    method: "get",
  });
};

//请求所有GPU数据
export const getAllGPUData = () => {
  return http({
    url: "/gpu/total",
    method: "get",
  });
};

//请求所有主板数据
export const getAllMainboardData = () => {
  return http({
    url: "/center/total",
    method: "get",
  });
};

//请求所有内存数据
export const getAllMemoryData = () => {
  return http({
    url: "/memory/total",
    method: "get",
  });
};

//请求所有SSD数据
export const getAllSSDData = () => {
  return http({
    url: "/ssd/total",
    method: "get",
  });
};

//请求所有HDD数据
export const getAllHDDData = () => {
  return http({
    url: "/hdd/total",
    method: "get",
  });
};